import os
import yaml

def set_env():
    dic=read_yaml("conf.yaml")
    os.environ["OPENAI_API_KEY"] = dic.get("OPENAI_API_KEY")
    os.environ["OPENAI_BASE_URL"] = dic.get("OPENAI_BASE_URL")
    os.environ["OPENAI_API_BASE"] = dic.get("OPENAI_API_BASE")

def read_yaml(yaml_file):
    conf_path=os.sep.join([os.path.dirname(os.path.abspath(__file__)),"conf"])
    file=os.sep.join([conf_path, yaml_file])
    dic=yaml.safe_load(open(file,encoding="utf-8"))
    return dic
